package member.zipcode;
import java.io.*;
import java.sql.*;
import java.util.*;

import javax.servlet.*;
import javax.servlet.http.*;

import db.member.*;
public class Zipcode extends HttpServlet{
	
	public void doPost(HttpServletRequest request,
			  HttpServletResponse response){
		System.out.println("post 방식으로 드러옴"+request);
			  try {requestPro(request,response);
			   } catch (Exception e) {
			    e.printStackTrace();
			   } 
			 }
	 public void doGet(HttpServletRequest request,
	  HttpServletResponse response){
	  try {requestPro(request,response);
	   } catch (Exception e) {
	    e.printStackTrace();
	   }
	 }
	 
	 public void requestPro(HttpServletRequest request,
			  HttpServletResponse response) throws Exception{
		 System.out.println("requestPro 입구입니다"+request);
			  MemberDAO dao=new MemberDAO();
			  List zipcode = new ArrayList();
			  request.setCharacterEncoding("EUC-KR");
			  String dong=request.getParameter("dong");
				zipcode=dao.Zipcode(dong);
			   	
			   	
			   	request.setAttribute("zipcode", zipcode);
			  RequestDispatcher rd= request.getRequestDispatcher("zipcode.jsp");
					  rd.forward(request, response);
		}
}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	/*public void doPost(HttpServletRequest request,
			  HttpServletResponse response){
			  try {requestPro(request,response);
			   } catch (Exception e) {
			    e.printStackTrace();
			   } 
			 }
	 public void doGet(HttpServletRequest request,
	  HttpServletResponse response){
	  try {requestPro(request,response);
	   } catch (Exception e) {
	    e.printStackTrace();
	   }
	 }
	 
	 public void requestPro(HttpServletRequest request,
			  HttpServletResponse response) throws Exception{
			  MemberDAO dao=new MemberDAO();
			  List zipcode = new ArrayList();
			  request.setCharacterEncoding("EUC-KR");
			  String dong=request.getParameter("dong");
			  System.out.println("동들고옴"+dong);
				zipcode=dao.Zipcode(dong);
			   	
			   	
			   	request.setAttribute("zipcode", zipcode);
			   	System.out.println("가지고 왔당"+zipcode);
			  RequestDispatcher rd= request.getRequestDispatcher("zipcode.jsp");
					  rd.forward(request, response);
		}
}
*/